<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
    <ol class="breadcrumb">
        <li><a href="#/realms/{{realm.realm}}/identity-provider-settings">{{:: 'identity-providers' | translate}}</a></li>
        <li data-ng-hide="newIdentityProvider">{{provider.name}}</li>
        <li data-ng-show="newIdentityProvider">{{:: 'add-identity-provider' | translate}}</li>
    </ol>

    <kc-tabs-identity-provider></kc-tabs-identity-provider>

    <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageIdentityProviders">
        <fieldset>
            <div class="form-group clearfix">
                <label class="col-md-2 control-label" for="redirectUri">{{:: 'redirect-uri' | translate}}</label>
                <div class="col-sm-6">
                    <input class="form-control" id="redirectUri" type="text" value="{{callbackUrl}}{{identityProvider.alias}}/endpoint" readonly kc-select-action="click">
                </div>
                <kc-tooltip>{{:: 'redirect-uri.tooltip' | translate}}</kc-tooltip>
            </div>
        </fieldset>
        <fieldset>
            <div class="form-group clearfix">
                <label class="col-md-2 control-label" for="clientId"><span class="required">*</span> {{:: 'bitbucket-consumer-key' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" id="clientId" type="text" ng-model="identityProvider.config.clientId" required>
                </div>
                <kc-tooltip>{{:: 'bitbucket.key.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group clearfix">
                <label class="col-md-2 control-label" for="clientSecret"><span class="required">*</span> {{:: 'bitbucket-consumer-secret' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" id="clientSecret" kc-password ng-model="identityProvider.config.clientSecret" required>
                </div>
                <kc-tooltip>{{:: 'bitbucket.secret.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group clearfix">
                <label class="col-md-2 control-label" for="defaultScope">{{:: 'default-scopes' | translate}} </label>
                <div class="col-md-6">
                    <input class="form-control" id="defaultScope" type="text" ng-model="identityProvider.config.defaultScope">
                </div>
                <kc-tooltip>{{:: 'bitbucket.default-scopes.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="enabled">{{:: 'store-tokens' | translate}}</label>
                <div class="col-md-6">
                    <input ng-model="identityProvider.storeToken" id="storeToken" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
                </div>
                <kc-tooltip>{{:: 'identity-provider.store-tokens.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="storedTokensReadable">{{:: 'stored-tokens-readable' | translate}}</label>
                <div class="col-md-6">
                    <input ng-model="identityProvider.addReadTokenRoleOnCreate" id="storedTokensReadable" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
                </div>
                <kc-tooltip>{{:: 'identity-provider.stored-tokens-readable.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="enabled">{{:: 'enabled' | translate}}</label>
                <div class="col-md-6">
                    <input ng-model="identityProvider.enabled" id="enabled" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
                </div>
                <kc-tooltip>{{:: 'identity-provider.enabled.tooltip' | translate}}</kc-tooltip>
            </div>
             <div class="form-group">
                <label class="col-md-2 control-label" for="trustEmail">{{:: 'trust-email' | translate}}</label>
                <div class="col-md-6">
                    <input ng-model="identityProvider.trustEmail" name="identityProvider.trustEmail" id="trustEmail" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
                </div>
                <kc-tooltip>{{:: 'trust-email.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="linkOnly">{{:: 'link-only' | translate}}</label>
                <div class="col-md-6">
                    <input ng-model="identityProvider.linkOnly" name="identityProvider.trustEmail" id="linkOnly" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
                </div>
                <kc-tooltip>{{:: 'link-only.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="hideOnLoginPage">{{:: 'hide-on-login-page' | translate}}</label>
                <div class="col-md-6">
                    <input ng-model="identityProvider.config.hideOnLoginPage" name="identityProvider.config.hideOnLoginPage" id="hideOnLoginPage" onoffswitchvalue on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
                </div>
                <kc-tooltip>{{:: 'hide-on-login-page.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="guiOrder">{{:: 'gui-order' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" id="guiOrder" type="text" ng-model="identityProvider.config.guiOrder">
                </div>
                <kc-tooltip>{{:: 'gui-order.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="firstBrokerLoginFlowAlias">{{:: 'first-broker-login-flow' | translate}}</label>
                <div class="col-md-6">
                    <div>
                        <select class="form-control" id="firstBrokerLoginFlowAlias"
                                ng-model="identityProvider.firstBrokerLoginFlowAlias"
                                ng-options="flow.alias as flow.alias for flow in authFlows"
                                required>
                        </select>
                    </div>
                </div>
                <kc-tooltip>{{:: 'first-broker-login-flow.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="postBrokerLoginFlowAlias">{{:: 'post-broker-login-flow' | translate}}</label>
                <div class="col-md-6">
                    <div>
                        <select class="form-control" id="postBrokerLoginFlowAlias"
                                ng-model="identityProvider.postBrokerLoginFlowAlias"
                                ng-options="flow.alias as flow.alias for flow in postBrokerAuthFlows">
                        </select>
                    </div>
                </div>
                <kc-tooltip>{{:: 'post-broker-login-flow.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="syncMode">{{:: 'sync-mode' | translate}}</label>
                <div class="col-md-6">
                    <div>
                        <select class="form-control" id="syncMode"
                                ng-model="identityProvider.config.syncMode"
                                required>
                            <option id="syncMode_import" name="syncMode" value="IMPORT">{{:: 'sync-mode.import' | translate}}</option>
                            <option id="syncMode_legacy" name="syncMode" value="LEGACY">{{:: 'sync-mode.legacy' | translate}}</option>
                            <option id="syncMode_force" name="syncMode" value="FORCE">{{:: 'sync-mode.force' | translate}}</option>
                        </select>
                    </div>
                </div>
                <kc-tooltip>{{:: 'sync-mode.tooltip' | translate}}</kc-tooltip>
            </div>
        </fieldset>

        <div class="form-group">
            <div class="col-md-10 col-md-offset-2">
                <button kc-save data-ng-disabled="!changed">{{:: 'save' | translate}}</button>
                <button kc-cancel data-ng-click="cancel()" data-ng-disabled="!changed">{{:: 'cancel' | translate}}</button>
            </div>
        </div>
    </form>
</div>

<kc-menu></kc-menu>